//
//  GHChongZhiRecordCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/16.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHChongZhiRecordCell.h"
@interface GHChongZhiRecordCell()
@property(nonatomic, strong) STButton                     *chongzhiButton;
@property(nonatomic, strong) STButton                     *statusButton;
@property(nonatomic, strong) STLabel                      *inputLable;//充值多少
@property(nonatomic, strong) STLabel                      *allMoneyLable;//余额多少
@property(nonatomic, strong) STLabel                      *desLable;//成功否
@end
@implementation GHChongZhiRecordCell

+ (CGFloat)CellHeight{
    return 100;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    self.chongzhiButton = [[STButton alloc] initWithFrame:CGRectMake(15, 25, 100, 20)
                                                     title:@"充值"
                                                titleColor:GH_firstTextColor
                                                 titleFont:15
                                              cornerRadius:0
                                           backgroundColor:nil
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"PC_zhanghumingxi"]];
    self.chongzhiButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
    [self addSubview:self.chongzhiButton];
    
    self.inputLable = [[STLabel alloc] initWithFrame:CGRectMake(0, 16, 200, 20)
                                                     text:@"+ 3000"
                                                textColor:GH_YellowBackGroundColor
                                                     font:18
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentRight];
    self.inputLable.st_right = UIScreenWidth - 15;
    [self addSubview:self.inputLable];
    
    self.allMoneyLable = [[STLabel alloc] initWithFrame:CGRectMake(0, self.inputLable.st_bottom + 3, 300, 15)
                                                   text:@"余额:10000"
                                           textColor:GH_secendTextColor
                                                font:13
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentRight];
    self.allMoneyLable.st_right = UIScreenWidth - 15;
    [self addSubview:self.allMoneyLable];
    
    //line
    UIView * line = [[UIView alloc] initWithFrame:CGRectMake(0, 45, UIScreenWidth, 0.5)];
    line.backgroundColor = GH_lineColor;
    line.st_top = self.allMoneyLable.st_bottom + 5;
    [self addSubview:line];
    
    self.statusButton = [[STButton alloc] initWithFrame:CGRectMake(15, 10 + line.st_bottom, 100, 20)
                                                    title:@"状态"
                                               titleColor:GH_firstTextColor
                                                titleFont:15
                                             cornerRadius:0
                                          backgroundColor:nil
                                          backgroundImage:nil
                                                    image:[UIImage imageNamed:@"PC_state"]];
    self.statusButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
    [self.statusButton setImage:[UIImage imageNamed:@"PC_state_red"] forState:UIControlStateSelected];
    [self addSubview:self.statusButton];
    
    self.desLable = [[STLabel alloc] initWithFrame:CGRectMake(0, self.inputLable.st_bottom + 3, 300, 15)
                                                   text:@"充值成功"
                                              textColor:GH_secendTextColor
                                                   font:14
                                            isSizetoFit:NO
                                          textAlignment:NSTextAlignmentRight];
    self.desLable.st_right = UIScreenWidth - 15;
    self.desLable.st_centerY = self.statusButton.st_centerY;
    [self addSubview:self.desLable];
}
- (void)setModel:(GHRechargeRecordModel *)model{
    _model = model;
    self.inputLable.text = [NSString stringWithFormat:@"+￥%@(%@)",model.money,model.typeString];
    self.allMoneyLable.text = [NSString stringWithFormat:@"余额:%@",model.u_money];
    
    if (model.status == 2) {
        self.statusButton.selected = YES;
    }else{
        self.statusButton.selected = NO;
    }
    
    self.desLable.text = model.statusString;
}
@end
